import sys
import os
from configurations.cpp import cp
sys.path.insert(0,cp.get("python_lib", "cv2_lib"))
import cv2
import numpy as np

def contrast_brightness_image(src1,a,g):
    """

    :param src1:  source pic
    :param a:  contrast
    :param g:  brightness
    :return:
    """
    h,w,c = src1.shape
    src2 = np.zeros([h,w,c],src1.dtype)
    dst= cv2.addWeighted(src1,a,src2,1-a,g)
    cv2.imshow("con-%f bri-%f demo"%(a,g),dst)


src = cv2.imread("/home/jack/Desktop/small.png")
cv2.imshow("origin",src)
for i in range(10):
    contrast_brightness_image(src,0.5 + i * 0.1, i * 3)
cv2.waitKey(0)
cv2.destroyAllWindows()